package com.pe1n.yangtaopai.view.activity;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.pe1n.yangtaopai.R;

public class OpinionActivity extends AppCompatActivity {
    private RelativeLayout mRelativeLayout;//绝对布局之返回
    private EditText mEditTextOpinion;//意见的书写
    private EditText mEditTextPhone;//电话
    private TextView mTextView;//确认
    private String strOpinion;
    private String strPhone;
    private Context mContext;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_opinion);
        initView();
    }

    private void initView() {
        mContext=this;
        mRelativeLayout= (RelativeLayout) findViewById(R.id.activity_opinion_relativeLayout_back);
        mEditTextOpinion= (EditText) findViewById(R.id.activity_opinion_editText_opinion);
        mEditTextPhone= (EditText) findViewById(R.id.activity_opinion_editText_po);
        mTextView= (TextView) findViewById(R.id.activity_opinion_textView_true);
        mRelativeLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        strOpinion= mEditTextOpinion.getText().toString();
        strPhone=mEditTextPhone.getText().toString();
        mTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //弹出的popupwandow可以取消
                View view= LayoutInflater.from(mContext).inflate(R.layout.not_net_layout,null,false);
                TextView textView= (TextView) view.findViewById(R.id.popupWindow_textView);
                textView.setText("提交成功!");
                PopupWindow popupWindow=new PopupWindow( view, ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
                popupWindow.setOutsideTouchable(true);
                popupWindow.setTouchable(true);
                popupWindow.showAtLocation(view, Gravity.CENTER,0,0);
            }
        });
    }
}
